var conect2;
function sendUrl(url) 
{
  if(url=='')
  {
        return;
  }
  
  conect2=postRequest();
  conect2.onreadystatechange = process;
  conect2.open("GET", url, true);
 
  //conect2.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  
  conect2.send(null);
}

function postRequest() 
{
  var xmlHttp=null;
  if (window.XMLHttpRequest) {
	  xmlHttp = new XMLHttpRequest();
  }
  else if (window.ActiveXObject) {
	      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  return xmlHttp;
}

function process()
{
  if(conect2.readyState == 4)
  {
	 
	  result(conect2.responseText);
  }else{
	  result(conect2.responseText);
  } 
}   
        function result(str){
            if(str=="yes"){
            	document.location.href='home.php';
            	//document.write(window.location='home.php');
        	}else if(str=="no"){
        		alert("se ha producido un error verifique los datos");
            	var error=document.getElementById("error");
            	style=error.style;
            	style.visibility="visible";
            }
        }
       
        function validate_login(){
    			    var email = document.getElementById("email").value;
    		        var password = document.getElementById("password").value;
    		        //alert("antes de enviar url");
    		        var url = "validate_loggin.php?email="+email+"&password="+password ;
    		        sendUrl(url);       
        }